package com.wanxin.car.carmng.dao;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.wanxin.car.carmng.model.Intermediary;


/**
 * 中介dao
 * @author lqk
 */
@Repository
public class IntermediaryDaoImpl {

	@Resource(name="hibernateTemplate")
	private HibernateTemplate ht;
	
	/**
	 * 根据id获取
	 */
	public Intermediary get( String id ){
		return ht.get(Intermediary.class, id);
	}

	/**
	 * 更新或保存
	 */
	@Transactional
	public void save( Intermediary e ){
		ht.saveOrUpdate(e);
	}
	
	/**
	 * 根据id删除
	 */
	@Transactional
	public void delete(String id) {
		ht.delete(new Intermediary(id));
	}
	
	/**
	 * 返回全部
	 */
	public List<Intermediary> gets(){
		return ht.find("from Intermediary");
	}
	
	

	public HibernateTemplate getHt() {
		return ht;
	}

	public void setHt(HibernateTemplate ht) {
		this.ht = ht;
	}
	
	
}
